﻿@using KRM.Core
@model IEnumerable<vWebDisputeApproval>
@{
    ViewBag.Title = "Approve RDMs";
    Layout = "~/Views/Shared/_Layout.cshtml";
    var rdm = new Rdm();
}

<div class="container-fluid">
    <fieldset>
        <legend>Search</legend>
        <form action="/rdm/approverdms" class="row-fluid">
            <div class="span1">Order Ref</div>
            <div class="span2">
                <input type="text" name="OrderRef" class="input-block-level" />
            </div>
            <div class="span1 text-right">Postcode</div>
            <div class="span2">
                <input type="text" name="Postcode" class="input-block-level" />
            </div>
            <div class="span2 text-right">Filter by status</div>
            <div class="span3">
                @Html.DropDownList("DisputeStatusID", null, new { onchange = "this.form.submit()" })
            </div>
            <div class="span1">
                <input type="submit" class="btn btn-primary" value="Search" /></div>
        </form>
    </fieldset>
    <div class="rdm-scroll">
        <table class="table table-bordered table-fix tbl-selected krmtable" data-height="200">
            <thead>
                <tr>
                    <th></th>
                    <th>OrderRef</th>
                    <th>Order Items</th>
                    <th>Reason</th>
                    <th>Preferred Resolution</th>
                    <th>Placed By</th>
                    <th>Date Placed</th>
                    <th>Postcode</th>
                </tr>
            </thead>
            <tbody>
                @foreach (var item in Model)
                {
                    var urgent = item.Urgent != null && (bool)item.Urgent;
                    var icon = rdm.GetRDMImageType(item);
                    <tr onclick="getrdmdetail(@item.DisputeID)" style="cursor: pointer; @(urgent ? "color:red" : "")" title="@rdm.GetRDMTooltip(item)">
                        <td>
                            @switch (icon)
                            {
                                case "warning":
                                    <img src="~/img/Error.png" alt="" style="width: 22px;" />
                                    break;
                                case "error":
                                    <img src="~/img/remove.png" alt="" style="width: 22px;" />
                                    break;
                                default: <div style="width: 22px"></div>
                                    break;
                            }
                        </td>
                        <td>@item.OrderReference</td>
                        <td>@item.OrderItems</td>
                        <td>@item.Reason</td>
                        <td>@item.PreferredResolution</td>
                        <td>@item.PlacedBy</td>
                        <td>@item.DatePlaced</td>
                        <td>@item.Postcode</td>
                    </tr>
                }
            </tbody>
        </table>
    </div>
    @Html.Partial("Partial/Rdm/_EditPhoto")
    @Html.Partial("Partial/Rdm/_EditDocument")
    <div class="rdm-detail">
    </div>
</div>
